home *** CD-ROM | disk | FTP | other *** search
- Path: grimsel.zurich.ibm.com!usenet
- From: wgk@zurich.ibm.com (Keith Whittingham)
- Newsgroups: comp.lang.c++
- Subject: Re: Small question
- Date: 7 Apr 1996 12:37:03 GMT
- Organization: IBM Research, ZRH
- Message-ID: <4k8ctf$oca@grimsel.zurich.ibm.com>
- References: <31674eeb.132847918@vixa.voyager.net>
- Reply-To: wgk@zurich.ibm.com
- NNTP-Posting-Host: pine.zurich.ibm.com
- X-Newsreader: IBM NewsReader/2 v1.00
-
- In <31674eeb.132847918@vixa.voyager.net>, sence@ava.taby.se (Bjorn Osterman) writes:
- >If I have 2 cpp files and i use the same global variable that i define
- >in some file that both cpp-files includes. How do I tell the compiler
- >that the variable is the same and that it shouldn't make space 2
- >times?
- >
-
- define it in one file as non-static e.g:
-
- int GobalInt;
-
- and in all others as extern
-
- extern int Global;
-
- That tells the compiler that it's defined elsewhere
-
- Keith
-
-
-